<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>destructuring</title>
</head>
<body>
<script>
    // ES5
   /* var a=1;
    var b=1;
    var c=1;*/

    // es6
    /*var [a,b,c]=[1,2,3]
    console.log(a);
    console.log(b);
    console.log(c);*/
    // demo2
    /*let [a,[[b],c]]=[1,[[2],3]]
    console.log(a);
    console.log(b);
    console.log(c)*/
    // demo3
   /* let [,,c]=[1,2,3];
    console.log(c);*/
    // demo4
    /*let [a,,c]=[1,2,3];
    console.log(a);
    console.log(c);*/
    // demo5
    /*let [a,...c]=[0,1,2,3,4,5,6,7,8,9];
    console.log(a);  /!*0*!/
    console.log(c);  /!*[1, 2, 3, 4, 5, 6, 7, 8, 9]*!/*/
    // demo6 error
    /*let [a]=[];
    console.log(a); /!*undefind*!/*/
    // demo7 error
    let [a]=[ ];
    console.log(a); /*undefind*/
    var [b,c]=[100];
    console.log(b)
    console.log(c)
</script>
</body>
</html>